<template>
	<scroll ref="mescrollRef" @init="mescrollInit" :down="downOption"  @down="downCallback" :up="upOption" @up="upCallback" @emptyclick="emptyClick">
		<stop isBack>
			<view slot="content">物资审核</view>
		</stop>
		<view class="bcf padlr3 padtb2 bdtso">
			<search class="fs8 tac" placeholder=" 单号 \ 物资名称 \ 编码 \ 型号"  v-model="search" @search="doSearch()"></search>
		</view>
		<view class="flrc bcf pad3 bdtso bdbso fs8">
			<view class="flex1"><scondition @input="reload()" model="StoreLogStatus" v-model="where.eq.status" label="审核状态"></scondition></view>
			<view class="flex1"><scondition @input="reload()" model="StoreLogType" v-model="where.eq.emergency" label="记录类型"></scondition></view>
			
		</view>
		<!-- <sradiomodel="MachineBreakLevel" v-model="where.eq.level"></sradio> -->
		<view class="padlr3">
			<view class="bcf pos-r mart3 pad2 round2 shadow" v-for="log in data" :key="log.id">
				<view class="flrc marb2" v-if="isbool(log.form)">
					<view class="flex1">{{log.form}}</view>
					<view class="cu-btn sm line-blue round marl2" @tap="copy(log.form)">复制</view>
				</view>
				<store-item :item="log.item"></store-item>
				<view class="bdtso lh2">
					<view class="flrc bdbda"><view class="flex1">数量:</view><view class="fs14 fwb">{{log.num}}</view></view>
					<view class="flrc bdbda"><view class="flex1">仓库:</view><view>{{objval(log,["inForm","store","name"])}}</view></view>
					<view class="flrc bdbda"><view class="flex1">类型:</view><view>{{objval(log,["inForm","type","name"])}}</view></view>
					<view class="flrc bdbda padtb2">
						<view class="flex1">流程状态:</view>
						<view v-if="isbool(log.status)">
							<status round :item="log.status"></status>
						</view>
					</view>
					<view class="padtb2" v-if="isbool(log.status) && log.status.sort == 1">
						<view class="cu-btn round w100 lg line-green" @tap="goto('/pages/store/store_log_check_form?id='+log.id)">
							确认状态<ripple></ripple>
						</view>
					</view>
				</view>
			</view>
		</view>
		<loading :loading="myIsLoading"></loading>
	</scroll>
</template>

<script>
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
	import List from '../../assets/js/list.js'
	
	
	import storeItem from '../../templete/store/store_item.vue'
	
	export default {
		mixins:[MescrollMixin],
		components:{storeItem},
		data() {
			let list = new List()
			return {
				list,
				where:{
					eq:{
						status:'',
						emergency:'',
						level:'',
					}
				},
				search:"",
				data:[]
			}
		},
		methods: {
			reload(){
				this.showLoading()
				this.data=[]
				this.list.setData({_order:{id:"DESC"},_where:this.where,_search:this.search}).reload()
			},
			doSearch(){
				this.showLoading()
				this.data=[]
				this.list.setData({_order:{id:"DESC"},_where:this.where,_search:this.search}).reload()
			}
		},
		mounted() {
			this.list.initMescroll(this).setUrl('/api/storeLogs').setData({
				_order:{id:"DESC"},
				_where:this.where,
				_search:this.search,
			}).setCbFunc(res=>{
				this.data = res
				this.clearLoading()
			}).reload()
		},
		onShow() {
			this.log("onshow")
			this.showLoading()
			this.list.reload()
		},
		watch:{
		}
	}
</script>

<style>

</style>
